home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: Parent Power / The Sunday Times - Parent Power.iso / pc / engine / search.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2005-11-04  |  2.5 KB  |  93 lines

  1. function scrollbar_init(tgt)
  2. {
  3.    var content = eval(tgt);
  4.    if(content._height < 600)
  5.    {
  6.       pcnt = 100 / content._height * scrollbar.bg._height;
  7.    }
  8.    else
  9.    {
  10.       pcnt = 100 / (content._height * 1.1) * scrollbar.bg._height;
  11.    }
  12.    if(pcnt <= 100)
  13.    {
  14.       scrollbar.slider._height = scrollbar.bg._height / 100 * pcnt;
  15.       scrollbar.slider.onPress = function()
  16.       {
  17.          var _loc1_ = this;
  18.          startDrag(_loc1_,0,_loc1_._x,0,_loc1_._x,_loc1_._parent.bg._height - _loc1_._height);
  19.       };
  20.       scrollbar.slider.onRelease = scrollbar.slider.onReleaseOutside = function()
  21.       {
  22.          stopDrag();
  23.       };
  24.       content.onLoad = function()
  25.       {
  26.          a = content._height - scrollbar.bg._height;
  27.          b = scrollbar.bg._height - scrollbar.slider._height;
  28.          dist = a / b;
  29.          startY = this._y;
  30.       };
  31.       content.onLoad();
  32.       content.onEnterFrame = function()
  33.       {
  34.          if(scrollbar.slider._y < scrollbar.bg._y)
  35.          {
  36.             scrollbar.slider._y = scrollbar.bg._y;
  37.          }
  38.          else if(scrollbar.slider._y + scrollbar.slider._height > scrollbar.bg._y + scrollbar.bg._height)
  39.          {
  40.             scrollbar.slider._y = scrollbar.bg._y + scrollbar.bg._height - scrollbar.slider._height;
  41.          }
  42.          else
  43.          {
  44.             var _loc1_ = scrollbar.bg._height - (scrollbar.slider._height + scrollbar.slider._y);
  45.             this._y = startY + (- (b - _loc1_) * dist);
  46.          }
  47.       };
  48.       scrollbar.bg.onPress = function()
  49.       {
  50.          scrollbar.slider._y = this._ymouse;
  51.       };
  52.       var mov = 1 / (content._height / 19) * scrollbar.bg._height;
  53.       scrollbar.up.onRelease = function()
  54.       {
  55.          scrollbar.slider._y -= mov;
  56.       };
  57.       scrollbar.down.onRelease = function()
  58.       {
  59.          scrollbar.slider._y += mov;
  60.       };
  61.    }
  62.    else
  63.    {
  64.       scrollbar.slider._height = scrollbar.bg._height;
  65.       scrollbar.slider._y = scrollbar.bg._y;
  66.    }
  67. }
  68. function displayPage()
  69. {
  70.    var _loc1_ = this;
  71.    var page = _parent.searchMovieFunction;
  72.    trace("page: " + page);
  73.    _loc1_.onEnterFrame = function()
  74.    {
  75.       var _loc1_ = this;
  76.       if(_loc1_._framesloaded >= _loc1_._totalframes)
  77.       {
  78.          if(page == "search")
  79.          {
  80.             gotoAndStop("search");
  81.             play();
  82.          }
  83.          else
  84.          {
  85.             gotoAndStop("tables_homepage");
  86.             play();
  87.          }
  88.          delete _loc1_.onEnterFrame;
  89.       }
  90.    };
  91. }
  92. displayPage();
  93.